import $service from '../../../../service.js';
const app = getApp()
let type;
Page({
    data: {
        questionsList:[]
    },
    onShow() {
        if($service.getStore('userInfo')) {
            type = JSON.parse($service.getStore('userInfo')).type;
            type === "D" ? this.getQuestionsListPc("2") : this.getQuestionsListPc("1");
        } else {
            this.getQuestionsListPc("1");
        }
    },
    getQuestionsListPc(type) {
        app.http.getQuestionsListPc({questionsType: type}).then(res => {
            this.setData({
                questionsList: res.data.list
            })
        }).catch(err => {
            $service.showToast(err.msg);
        })
    },
    tapisshow(e){
        var index =  e.currentTarget.dataset.index;
        this.data.questionsList[index].isshow = !this.data.questionsList[index].isshow
        this.setData({
            questionsList : this.data.questionsList
        })
    }
})
